package office.word.openoffice;

import org.jodconverter.core.document.DefaultDocumentFormatRegistry;
import org.jodconverter.local.JodConverter;
import org.jodconverter.local.office.LocalOfficeManager;

import java.io.File;

/**
 * 描述
 *
 * @author: zhanglu
 * @date: 2023/7/24 09:25
 * @modify: 修改人信息, 修改内容 2023/7/24 09:25
 */
public class ConvertTest {

    public static void main(String[] args) throws Exception {
        String in = "/Users/zhanglu/Desktop/tmp/docx4j/word_template2.docx";
        String out = "/Users/zhanglu/Desktop/tmp/docx4j/word_template2.pdf";
        LocalOfficeManager officeManager = LocalOfficeManager.builder()
                .install()
                .portNumbers(2002)
                .build();
        officeManager.start();
        JodConverter.convert(new File(in)).as(DefaultDocumentFormatRegistry.DOCX)
                .to(new File(out)).as(DefaultDocumentFormatRegistry.PDF)
                .execute();
    }

}
